package homework_06.home_04;

public class Student {
    String name;
    String no;
    int score;

    public Student() {
    }

    public Student(String name, String no, int score) {
        this.name = name;
        this.no = no;
        this.score = score;
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", no='" + no + '\'' +
                ", score=" + score +
                '}';
    }

    public void print(Student[] stus){
        //排序
        for(int i=1;i<stus.length;i++){
            for(int j=0;j<stus.length-i;j++){
                if(stus[j].score<stus[j+1].score){
                    Student stu=stus[j];
                    stus[j]=stus[j+1];
                    stus[j+1]=stu;
                }
            }
        }
        //输出
        for (int i=0;i<stus.length;i++){
//            System.out.println(stus[i].no+"\t"+stus[i].name+"\t"+stus[i].score);
            System.out.println(stus[i].toString());
        }


    }

}
